HTML CSS in 8 Hours: For Beginners, Learn Coding Fast! by Yao Ray

HTML CSS in 8 Hours: For Beginners, Learn Coding Fast! by Yao Ray

Author:Yao, Ray [Yao, Ray]
Language: eng
Format: epub
Publisher: In 8 Hours eBooks & Books
Published: 2020-06-28T16:00:00+00:00


Example 6.8

<html>

<style type = "text/css">

#b1{border-style: solid; border-width: 5px; margin: 30px }

#b2{border-style: dotted; border-width: 5px; margin: 0px }

</style>

<p id = "b1">This margin is 30px. </p>

<p id = "b2">This margin is 0px. </p>

</html>

Output:

Explanation: “margin: value” can set the margin width.

Absolute Positioning

The content position can be specified by position attribute.

position: absolute; top: value; left: value;

“position: absolute” sets the precise location of the contents.

“top: value” sets the distance from the top edge of the window.

“left: value” sets the distance from the left edge of the window.

Example 6.9

<html>

<style type = "text/css">

#a1{ position:absolute; top: 0px; left: 30px }

#a2{ position:absolute; top: 30px; left: 60px }

</style>

<p id = "a1">This is position1. </p>

<p id = "a2">This is position2. </p>

</html>

Output:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.